package main

import (
	"fmt"
	"strings"
)

func lengthOfLongestSubstring(s string) int {
	if len(s) == 1 {
		return 1
	}
	max := 0
	for i := 0; i < len(s); i++ {
		str := string(s[i]) //a
		for j := i + 1; j < len(s); j++ {
			if max < len(str) {
				max = len(str)
			}
			if strings.Contains(str, string(s[j])) {
				break
			}
			str += string(s[j])
			if max < len(str) {
				max = len(str)
			}
		}

	}
	return max
}
func main() {
	s := "bbbbb"
	fmt.Println(lengthOfLongestSubstring(s))
}
